const Good = require("../model/goods.js");
//商品列表查询功能
const goodslist = async function(ctx) {
    let result = {
        errCode: 0
    };    
	let goods1 = await Good.find({"goodType": 1});
	let goods2 = await Good.find({"goodType": 2});
	let goods3 = await Good.find({"goodType": 4});
	if(goods1.length==0&&goods2.length==0&&goods3.length==0){
		result.errCode = 1
        result.errMsg = '没有找到查询结果'
        ctx.body = result
        return
	}else{
		result.errCode = 0
        result.errMsg = '查询到结果'
        result.list={type1:goods1,type2:goods2,type3:goods3}
        ctx.body = result
        return
	}
};
module.exports = goodslist;
